﻿@using DualControl.Web.Models.Common.Modals
@using DualControl.CommonServices

@model DualControl.RiskPoints.Dtos.RiskPointEditDto
@inject ICommonService CommonService

@{
    Layout = null;
}
@Html.Partial("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel("编辑风险点信息"))

<div class="modal-body">
   
    <form name="UserEditForm" role="form" novalidate class="form-validation">
        <input type="hidden" name="Id" value="@Model.Id" />
        <ul class="nav nav-tabs tab-nav-right" role="tablist">
            <li role="presentation" class="active"><a href="#riskpoint-details" data-toggle="tab">基本信息</a></li>
            <li role="presentation"><a href="#edit-accident-roles" data-toggle="tab">风险点诱发事故类型</a></li>
        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane animated fadeIn active" id="riskpoint-details">
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">风险点编号</label>
                            <input class="form-control" type="text" name="Code" required value="@Model.Code" placeholder="请输入风险点编号">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">

                            <label class="form-label">责任部门</label> <br />

                            @Html.DropDownListFor(m=>m.OrganizationUnitId,
                                    CommonService.GetOrganizationUnits().Select(c =>
                                    new SelectListItem() { Text = c.Value.ToString(), Value = c.Key.ToString() }), "==请选择责任部门==", new { @class = "dropdownlist" })

                        </div>
                    </div>
                </div>
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">区域工段</label>
                            <input class="form-control" type="text" name="AreaOrSection" placeholder="请输入区域工段." value="@Model.AreaOrSection" required>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">风险点名称</label>
                            <input class="form-control" type="text" name="Name" placeholder="请输入风险点名称" value="@Model.Name" required>
                        </div>
                    </div>
                </div>
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">风险点位置</label>
                            <input class="form-control" type="text" name="Location" placeholder="请输入风险点位置" required value="@Model.Location" minlength="3">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">作业目的</label>
                            <input class="form-control" type="text" name="OperationPurpose" placeholder="请输入作业目的" value="@Model.OperationPurpose" required minlength="3">
                        </div>
                    </div>
                </div>
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">风险点安全事故影响</label>

                            <input class="form-control" type="text" name="AccidentConsequences" placeholder="请输入风险点安全事故影响" value="@Model.AccidentConsequences" required minlength="3">

                        </div>

                    </div>
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">备注</label>
                            <input class="form-control" type="text" name="Note" placeholder="请输入备注" required minlength="3" value="@Model.Note">
                        </div>
                    </div>
                </div>          

            </div>
            <div role="tabpanel" class="tab-pane animated fadeIn" id="edit-accident-roles">
                <div class="row">
                    <div class="col-sm-12 ">
                        @foreach (var accident in CommonService.AccidentTypes())
                        {
                        <div class="col-sm-6">
                            @if (Model.AccidentTypes.Contains(accident.Key.ToString()))
                            {

                                <input type="checkbox" name="accidentlist"  value="@accident.Key" title="@accident.Value" class="filled-in" checked="checked" id="role-@accident.Key" />
                                @accident.Value
                            }
                            else
                            {
                                <input type="checkbox"  name="accidentlist"  value="@accident.Key" title="@accident.Value" class="filled-in" id="role-@accident.Key" />
                                @accident.Value
                            }
                        </div>
                            }
                            </div>
                </div>
            </div>
        </div>
    </form>
</div>

@Html.Partial("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")

<script src="~/view-resources/Views/RiskPoints/_EditRiskPointModal.js" asp-append-version="true"></script>
